<!--申请售后-->
<div id="customer-service-modal" class="modal fade modal_small" tabindex="1" role="dialog" aria-labelledby="myModalLabel1" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>
                <h4 class="modal-title">申请售后</h4>
            </div>
            <form action="<?php echo getUrl('order/home/customerService')?>" class="form-horizontal" id="customer-service-form" method="post">
                <div class="modal-body">
                    <div class="form-group">
                        <label class="control-label col-md-2">退款金额<span class="required">*</span></label>
                        <div class="col-md-10">
                            <input class="form-control required number" name="refund_amount" type="tel" value="<?php echo $info['reality_amount']?>"/>
                            <span>退款金额最多为：<span class="yuan"><?php echo $info['reality_amount']?></span>（元）</span>
                        </div>
                    </div>
                    <div class="form-group" id="region" data-url="<?php echo getUrl('common/ajaxChangeCheck');?>">
                        <label class="control-label col-md-2">售后原因<span class="required">*</span></label>
                        <div class="col-xs-10">
                            <select name="reason" class="form-control">
                                <option value="">请选择售后原因</option>
                                <?php foreach ($reason as $r): ?>
                                    <option value="<?php echo $r?>" ><?php echo $r?></option>
                                <?php endforeach;?>
                            </select>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="control-label col-md-2">描述原因<span class="required">*</span></label>
                        <div class="col-md-10">
                            <textarea name="remark" placeholder="请输入描述售后原因" rows="3" class="form-control required"></textarea>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="control-label col-md-2">图片</label>
                        <div class="col-md-10">
                            <div id="uploader-demo">
                                <!--用来存放item-->
                                <div class="uploader-list">
<!--                                    --><?php //if (! $add && $info['img']):?>
<!--                                        --><?php // foreach ($info['img'] as $v):?>
<!--                                            <div id="" class="file-item thumbnail pic-list">-->
<!--                                                <img src="--><?php //echo $v; ?><!--">-->
<!--                                                <a title="删除" class="delete-btn hide" href="javascript:void(0);" style="color:#b94a48;position:absolute;top:-10px;right:-5px;background-color:#ffff;height:17px;width:15px;font-size:12px;padding:2px;">-->
<!--                                                    <i class="fa fa-times"></i>-->
<!--                                                </a>-->
<!--                                                <input name="img[]" type="hidden" class="file-name" value="--><?php //echo $v; ?><!--">-->
<!--                                            </div>-->
<!--                                        --><?php //endforeach; endif;?>
                                    <div id="filePicker" class="file-item thumbnail webuploader-container">
                                        <div class="webuploader-pick">
                                            <div style="position:absolute;top:0;left:0;width:100%;height:100%;padding-top:70px;color:grey;margin-top: 8px;">选择图片</div>
                                            <img title="选择上传图片" src="<?php echo getDefaultImg(); ?>">
                                        </div>
                                        <div id="rt_rt_1c2t7atu83351ra0bvm7gcgnu1" style="position: absolute; top: 4px; left: 4px; width: 100px; height: 100px; overflow: hidden; bottom: auto; right: auto;">
                                            <input type="file" name="file" class="webuploader-element-invisible" multiple="multiple" accept="image/*">
                                            <label style="opacity: 0; width: 100%; height: 100%; display: block; cursor: pointer; background: rgb(255, 255, 255);">
                                            </label>
                                        </div>
                                    </div>
                                </div>
                                <script type="text/javascript">
                                    $(function(){
                                        uploadImg({
                                            box:'#uploader-demo',
                                            uploadBtn:"#filePicker",
                                            fileName:'img[]',
                                            width:110,  //显示缩略图宽带
                                            uploadUrl:'<?php echo getUrl('product/home/uploadImgs');?>',
                                            height:100,	//显示缩略图高度
                                            number:3
                                        });

                                    });

                                </script>
                            </div>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="control-label col-md-2">操作备注<span class="required">*</span></label>
                        <div class="col-md-10">
                            <textarea name="note" placeholder="请输入操作备注" rows="3" class="form-control required"></textarea>
                        </div>
                    </div>
                </div>
                <div class="modal-footer">
                    <input type="hidden" name="order_id" value="<?php echo $info["id"]?>" >
<!--                    <input type="hidden" name="id">-->
                    <button class="btn default" data-dismiss="modal" aria-hidden="true"><i class="fa fa-times"></i> 关闭</button>
                    <button class="btn green field-submit-btn"><i class="fa fa-save"></i> 保存</button>
                    <script type="text/javascript">
                        $(function () {
                            var modal = $("#customer-service-modal");

                            $(".customer-service").live('click',function () {
//                                App.blockUI();
//                                var id = "<?php //echo $info['id']?>//"; // $(this).parent().attr('data-id');
                                $(this).parent().addClass('service-btn');
                                $(this).parent().prev().addClass('after-sale');
//                                modal.find('[name="id"]').val(id);
                                modal.find('.has-error').removeClass('has-error').find('.validate_message').remove();
                                modal.find('.show_message_error').remove();
//                                modal.find('[name="refund_amount"]').val(data.reality_amount);
//                                modal.find('.yuan').html(data.reality_amount);
                                modal.modal();
//                                $.ajax('<?php //echo getUrl('order/home/getOrderProductInfo')?>//', {
//                                    dataType:'json',
//                                    type:'post',
//                                    data:{id:id},
//                                    error:function(){
//                                        show_message({status:0, message:'请求超时'});
//                                        App.unblockUI();
//                                    },
//                                    timeout:60000,
//                                    success:function(data,textStatus,jqXHR){
//                                        if (data.status == 0){
//                                            show_message(data);
//                                            return false;
//                                        }
//                                        modal.find('.has-error').removeClass('has-error').find('.validate_message').remove();
//                                        modal.find('.show_message_error').remove();
//                                        modal.find('[name="refund_amount"]').val(data.reality_amount);
//                                        modal.find('.yuan').html(data.reality_amount);
//                                        modal.modal();
//                                        App.unblockUI();
//                                    }
//                                });
                            });

                            $.e_validate.init('#customer-service-form',{modal:modal,ignore:'',successCallback:function(data){
                                $(".service-btn").find('a').remove();
                                $(".service-btn").removeClass('service-btn');
                                $(".after-sale").html('已申请');
                                $("#data-table").dataTable().fnDraw(true);
                            }});
                        });
                    </script>
                </div>
            </form>
        </div>
    </div>
</div>